<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>获取键盘键值：请按任意键</title>

<script type="text/javascript" language="javascript">   
<!--     
function   keyDown()   {     
var   keycode   =   event.keyCode     
var   realkey   =   String.fromCharCode(event.keyCode)     
alert("keycode:   "   +   keycode   +   "/nrealkey:   "   +   realkey)   }     
document.onkeydown   =   keyDown     
//-->   
</script>

</head>
<body>
    <p class="p2">sdfsdf</p>
</body>
</html>